package com.boc.ewr.util.file.enumeration;

import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Optional;
/**
 * 账户状态-对账
 */
@Slf4j
public enum CaAccountStatusEnum {
    NORECACC("2", "不对账账户"),
    SECRECYACC("3", "保密账户"),
    TOHOMEACC("9", "上门服务账户"),
    ORDINARYACC("1", "普通账户"),

    // 以下为新增，小额非重点账户专用枚举
    ACC_EFFECTIVE("4","生效"),
    ACC_UNCHANGED("5","不动户"),
    ACC_SHUTDOWN("6","关户"),
    ACC_UNPRI("7","产品不对账");


    private String index;
    private String value;

    CaAccountStatusEnum(String index, String value){

        this.index = index;
        this.value = value;
    }

    /**
     * 根据value获取枚举对象
     *
     * @param val
     * @return
     */
    public static CaAccountStatusEnum getIndexByValue(String val) {
        Optional<CaAccountStatusEnum> first = Arrays.stream(CaAccountStatusEnum.values()).filter(e -> e.getValue().equals(val)).findFirst();
        CaAccountStatusEnum expEnum = first.orElse(null);
        log.info("选择的枚举类型是：" + expEnum.toString());
        return expEnum;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
